<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/plug/layui/css/layui.css">
    <style type="text/css">
        * {
            margin: 0;
            padding: 0;
        }

        body {
            padding: 16px;
        }
    </style>
</head>
<body>
<button type="button" class="layui-btn layui-btn-primary" id="add">
    <i class="layui-icon layui-icon-addition"></i> 添加数据
</button>
<table id="test"></table>
<script src="/plug/layui/layui.js"></script>
<script>
    layui.use('table', function () {

        //获取jquery
        let $ = layui.jquery;
        $('#add').click(function () {
            window.open("/pc/index/add/")
        });

        var table = layui.table;
        table.render({
            elem: '#test'
            , url: '/api/account/sel'
            , cols: [[
                {field: 'account_id', title: '序号', sort: true},
                {field: 'account_no', title: '学号'},
                {field: 'account_name', title: '姓名'},
                {field: 'account_gender', title: '性别'},
                {field: 'add_time', title: '注册时间'},
            ]]
        });
    });
</script>
</body>
</html>
